package main

import "fmt"

// 结构体嵌套结构体
type Person struct {
	id int
	name string
	age int
	sex string
}

type Student struct {
	// 将Person结构作为Student结构体的成员
	//Person			// 匿名字段实现继承关系
	//p Person				// 为Person结构体起个名字
	Person					// 匿名字段实现继承关系
	class int
	score int
}

func main0101() {
	var stu Student
	//stu.Person.name = "张三"
	//stu.Person.age = 18
	//stu.Person.id = 1001
	stu.name = "张三"
	stu.age = 18
	stu.id = 1001
	stu.sex = "女"
	stu.class = 302
	stu.score = 99
	fmt.Println(stu)
}

func main(){
	var stu Student = Student{Person{1001,"宇智波佐助",16,"男"},302,100}
	fmt.Println(stu)
}